#region

using System;
using EsbMonitorMessages.ServiceDescription;
using NServiceBus;

#endregion

namespace TestHost
{
    [Description("OrderCreated Summary")]
    public class OrderCreated : IMessage
    {
        [Description("Nazwa zamowienia")]
        public String OrderName { get; set; }

        [Description("Typ zamowienia (jednorazowe, powtarzalne, reklamacja)")]
        public String OrderType { get; set; }

        [Description("Ilosc zamowionych jednostek")]
        public long Quantity { get; set; }

        [Description("Cena jednostkowa")]
        public float UnitPrice { get; set; }
    }

    [Description("OrderDelivered Summary")]
    public class OrderDelivered : OrderCreated
    {
    }

    public class TestHndl : IHandleMessages<OrderCreated>, IHandleMessages<OrderDelivered>
    {
        public void Handle(OrderCreated message)
        {
            throw new NotImplementedException();
        }

        public void Handle(OrderDelivered message)
        {
            throw new NotImplementedException();
        }
    }

//    public class ClientEndpoint : IWantToRunAtStartup
//    {
//        public IBus Bus { get; set; }
//
//        #region IWantToRunAtStartup Members
//
//        public void Run()
//        {
//            Console.WriteLine("Press 'Enter' to send a message.To exit, Ctrl + C");
//            Guid guid = Guid.NewGuid();
//            while (Console.ReadLine() != null)
//            {
//                Guid g = Guid.NewGuid();
//
//                Console.WriteLine("Requesting to get data by id: {0}", g.ToString("N"));
//
//                var unicastBus = (UnicastBus) Bus;
//                unicastBus.ClientSubscribed += (sender, e) => Console.WriteLine("Koles sie zasubskrybowal");
//
//                foreach (String messageOwner in unicastBus.MessageOwners.Keys)
//                {
//                    if (!messageOwner.StartsWith("NServiceBus"))
//                    {
//                        Assembly a = Assembly.Load(messageOwner);
//                            SendMessageAssemblyInfo(a);
//                    }
//                }
//
//                
//
//                Bus.Send<IPublisherStarted>(m =>
//                                                {
//                                                    m.EventId = Guid.NewGuid();
//                                                    m.Guid = guid;
//                                                    m.Name = "Michal";
//                                                    m.EventTime = DateTime.Now;
//                                                    m.InputQueueName = "loage";
//                                                });
//            }
//        }
//
//        public void Stop()
//        {
//        }
//
//        #endregion
//
//        private void SendMessageAssemblyInfo(Assembly assembly)
//        {
//            string fullName = assembly.FullName;
//            string location = assembly.Location;
//            string fileName = assembly.ManifestModule.ScopeName;
//            Guid moduleVersionId = assembly.ManifestModule.ModuleVersionId;
//
//            byte[] binaryData = File.ReadAllBytes(location);
//
//            Bus.Send<IMessageAssemblyLoaded>(m =>
//                                                      {
//                                                          m.FileName = fileName;
//                                                          m.FullName = fullName;
//                                                          m.ModuleVersionId = moduleVersionId;
//                                                          m.BinaryData = binaryData;
//                                                      }
//                );
//        }
//    }
}